package com.lin.manager.file.oss;

import com.lin.manager.file.entity.FileConfigEntity;
import com.lin.manager.file.model.vo.FileVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * @作者: 林江
 * @创建时间: 2024/3/22
 * @功能: 云服务上传接口
 */
@Slf4j
public class TencentOssServiceImpl extends AbstractOssService {
    private OssService delegate;

    public TencentOssServiceImpl() {
        super("");
    }

    @Override
    public void doUpload(MultipartFile file, FileConfigEntity fileConfig, Map<String, Object> resp) throws Exception {
        if (isSupport(fileConfig.getPlatform())) {
            log.info("腾讯云对象存储上传。。。。。。。。。。。。");

        }
        delegate.doUpload(file, fileConfig, resp);
    }

    @Override
    public void doDownload(HttpServletResponse response, FileVo fileVo, FileConfigEntity fileConfig) throws Exception {
        if (isSupport(fileConfig.getPlatform())) {
            log.info("腾讯云对象存储下载。。。。。。。。。。。。");

            return;
        }
        delegate.doDownload(response, fileVo, fileConfig);
    }

    @Override
    public void next(OssService delegate) {
        this.delegate = delegate;
    }

}
